/*
 * @Author: 晴鸢. 3013433857@qq.com
 * @Date: 2025-09-28 17:51:05
 * @LastEditors: 晴鸢. 3013433857@qq.com
 * @LastEditTime: 2025-09-28 17:53:04
 * @FilePath: /Learn/test/main.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include<iostream>
#include"Threadpool.hpp"
#include<ctime>
#include"Task.hpp"
int  main()
{
    ThreadPool<Task>*tp=new ThreadPool<Task>(5);
    //创建一个线程池
    tp->start();
    srand(time(nullptr));
    while(1)
    {
        //1.创建任务
        int x=rand()%10+1;
        usleep(10);
        int y=rand()%5;
        char op=opers[rand()%opers.size()];
        Task t(x,y,op);
        std::cout<<"main thread make task:"<<t.getTask()<<std::endl;   
        tp->Push(t);
        //2.交给线程池处理     
        sleep(1);
    }

    return 0;
}